/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vamprest;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author sav
 */
@Entity
@Table(name = "memberaddress")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Memberaddress.findAll", query = "SELECT m FROM Memberaddress m"),
    @NamedQuery(name = "Memberaddress.findByIdmember", query = "SELECT m FROM Memberaddress m WHERE m.memberaddressPK.idmember = :idmember"),
    @NamedQuery(name = "Memberaddress.findByIdaddress", query = "SELECT m FROM Memberaddress m WHERE m.memberaddressPK.idaddress = :idaddress")})
public class Memberaddress implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected MemberaddressPK memberaddressPK;

    public Memberaddress() {
    }

    public Memberaddress(MemberaddressPK memberaddressPK) {
        this.memberaddressPK = memberaddressPK;
    }

    public Memberaddress(int idmember, int idaddress) {
        this.memberaddressPK = new MemberaddressPK(idmember, idaddress);
    }

    public MemberaddressPK getMemberaddressPK() {
        return memberaddressPK;
    }

    public void setMemberaddressPK(MemberaddressPK memberaddressPK) {
        this.memberaddressPK = memberaddressPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (memberaddressPK != null ? memberaddressPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Memberaddress)) {
            return false;
        }
        Memberaddress other = (Memberaddress) object;
        if ((this.memberaddressPK == null && other.memberaddressPK != null) || (this.memberaddressPK != null && !this.memberaddressPK.equals(other.memberaddressPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vamprest.Memberaddress[ memberaddressPK=" + memberaddressPK + " ]";
    }

}
